package com.core.website.api;

import com.core.website.common.Result;
import com.core.website.common.ResultUtil;
import com.core.website.scheduled.ClickNumScheduleTask;
import com.core.website.scheduled.SaticScheduleTask;
import com.core.website.service.EsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/esApi")
public class EsApi {
    @Autowired
    private EsService esService;
    @Autowired
    private SaticScheduleTask saticScheduleTask;
    @Autowired
    private ClickNumScheduleTask clickNumScheduleTask;
    @GetMapping("/init")
    public Result init(){
        esService.initContent();
        return ResultUtil.success();
    }
    @GetMapping("/unNew")
    public Result unNew(){
        saticScheduleTask.configureTasks();
        return ResultUtil.success();
    }
    @GetMapping("/updateNum")
    public Result updateNum(Integer num){
        clickNumScheduleTask.num = num;
        clickNumScheduleTask.configureTasks();
        return ResultUtil.success();
    }
}
